package com.webserver1.core;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class ClientHandler implements Runnable {
    private Socket socket;
    public ClientHandler(Socket socket){
        this.socket = socket;
    }
    public void run(){
        try {
            InputStream in = socket.getInputStream();
            StringBuilder builder = new StringBuilder();
            char pre = 'a',cur = 'a';
            int d ;
            while ((d = in.read()) !=-1){
                cur = (char) d;
                if (pre==13 && cur==10){
                    break;
                }
                builder.append(d);
                pre = cur;
                String line = builder.toString().trim();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
